<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <include file="share:meta" />
    <script type="text/javascript">
    wait = false;
    timer = 0;
    function sendsms() {
        if (wait) {
            return;
        }
        if ($('#mobile').val().length != 11) {
            alert('请输入正确的手机号码');
            return;
        }
        if ($('#imgverify').val().length != 4) {
            alert('请输入图形验证码');
            return;
        }
        wait = true;
        time = 60;
        $.ajax({
            type: "POST",
            url: "/club/account/bindsmsnovip",
            data: "mobile=" + $('#mobile').val() + "&imgverify=" + $('#imgverify').val(),
            dataType: "json", // html/json/jsonp/xml
            success: function(msg) {
                if(msg.status == 0){
                    alert(msg.msg);
                    resetInt();
                }else{
                    alert(msg.msg);
                }
            },
            error: function() {
                
            }
        });
        $('#verifybutton').html(time + "秒后重发");
        timer = setInterval(function() {
            time--;
            $('#verifybutton').html(time + "秒后重发");
            if (time <= 0) {
                resetInt();
                wait = false;
            }
        }, 1000);
    }

    function resetInt(){
        $('#verifybutton').html('重新发送');
        clearInterval(timer);
        wait = false;
        $('#imgverifyp').click();
    }
	
	function checkform() {
		if($('input[name=name]').val()=='') {
			$('input[name=name]').focus();
			return false;
		}
		if($('select[name=sex]').val()=='') {
			$('select[name=sex]').focus();
			return false;
		}
		if($('input[name=imgverify]').val()=='') {
			$('input[name=imgverify]').focus();
			return false;
		}
		if($('input[name=mobile]').val()=='') {
			$('input[name=mobile]').focus();
			return false;
		}
		if($('input[name=verify]').val()=='') {
			$('input[name=verify]').focus();
			return false;
		}
		
		return true;
	}
    </script>
</head>

<body>
    <div id="reserve" class="container-fluid">
        <br>
        <br>
        <br>
        <br>
        <form action="" method="post" enctype="multipart/form-data" onSubmit="return checkform()">
            <div class="row detail">
            	<div class="hang kuang">
                    <div class="col-xs-1"></div>
                    <div class="col-xs-3 line">姓名</div>
                    <div class="col-xs-4 line">
                        <input type="text" name="name" value="" placeholder="姓名">
                    </div>
                    <div class="col-xs-3 line">
                    	<i class="fa fa-user" aria-hidden="true" style="font-size:20px; margin-top:3px;color:#BEBEBE;"></i>
                    </div>
                    <div class="col-xs-1"></div>
                </div>
                <div class="hang kuang">
                    <div class="col-xs-1"></div>
                    <div class="col-xs-3 line">性别</div>
                    <div class="col-xs-4 line">
                    	<select name="sex"  class="tongyong" style="">
                        	<option value="">请选择性别</option>
							<option value="男">男</option>
                            <option value="女">女</option>
						</select>
                    </div>
                    <div class="col-xs-3 line">
                        <i class="fa fa-male" aria-hidden="true" style="font-size:25px; margin-top:3px;color:#BEBEBE;"></i>
                    </div>
                    <div class="col-xs-1"></div>
                </div>
                <div class="hang kuang">
                    <div class="col-xs-1"></div>
                    <div class="col-xs-3 line">图形验证码</div>
                    <div class="col-xs-4 line">
                        <input type="number" name="imgverify" id="imgverify" value="" placeholder="图形验证码">
                    </div>
                    <div class="col-xs-3 line">
                        <img class="verify" id="imgverifyp" style="width:80px; height:30px;" src="/club/ajax/verify" onClick="this.src = '/club/ajax/verify?rand=' + Math.random();">
                    </div>
                    <div class="col-xs-1"></div>
                </div>
                <div class="hang kuang">
                    <div class="col-xs-1"></div>
                    <div class="col-xs-3 line">手机号码</div>
                    <div class="col-xs-4 line">
                        <input type="number" id="mobile" class="bigInput" name="mobile" value="" placeholder="手机号码">
                    </div>
                    <div class="col-xs-4 line">
                        <i class="fa" id="verifybutton" aria-hidden="true" style="font-size:14px; margin-top:8px; color:#1f1f1f;line-height:20px;" onClick="sendsms();">发送验证码</i>
                    </div>
                </div>
                <div class="hang kuang">
                    <div class="col-xs-1"></div>
                    <div class="col-xs-3 line">手机验证码</div>
                    <div class="col-xs-4 line">
                        <input type="number" name="verify" value="" placeholder="手机验证码">
                    </div>
                    <div class="col-xs-3 line">
                    	<i class="fa fa-lock" aria-hidden="true" style="font-size:25px; margin-top:3px;color:#BEBEBE;"></i>
                    </div>
                    <div class="col-xs-1"></div>
                </div>
                <br>
                <br>
                <div class="hang tijiao">
                    <div class="col-xs-2"></div>
                    <div class="col-xs-8">
                        <input type="submit" value="注册会员">
                    </div>
                    <div class="col-xs-2"></div>
                </div>
            </div>
        </form>
    </div>
    <include file="share:menu" />
</body>

</html>
